<%-- 
    Document   : viewerprofile
    Created on : Apr 27, 2011, 10:38:07 AM
    Author     : Kevin
--%>

<%@page contentType="text/html" import="com.movie.*" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="headerv.html"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Edit your profile</title>
        <script type="text/javascript">
            function validate(){
                with(document.form1){
                    if(password.value.length < 1){
                        alert("please input password");
                        password.focus();
                        return false;                        
                    }
                    if(password.value.length < 5){
                        alert("password must be more than 6 characters");
                        password.focus();
                        return false;                        
                    }
                    if(password.value.length > 20){
                        alert("password must be less than 20 characters");
                        password.focus();
                        return false;                        
                    }
                    if(nickname.value.length < 1){
                        alert("please input nickname");
                        nickname.focus();
                        return false;                        
                    }
                    if(nickname.value.length > 20){
                        alert("nickname must be less than 20 characters");
                        nickname.focus();
                        return false;                        
                    }
                    if(firstname.value.length < 1){
                        alert("please input firstname");
                        firstname.focus();
                        return false;                        
                    }                  
                  
                    if(firstname.value.length > 20){
                        alert("firstname must be less than 20 characters");
                        firstname.focus();
                        return false;                        
                    }
                    if(lastname.value.length < 1){
                        alert("please input lastname");
                        lastname.focus();
                        return false;                        
                    }                  
                  
                    if(lastname.value.length > 20){
                        alert("lastname must be less than 20 characters");
                        lastname.focus();
                        return false;                        
                    }
                    if(email.value.length < 1){
                        alert("please input email");
                        email.focus();
                        return false;                        
                    }
                    if(calendarField.value.length < 1){
                        alert("please input birthday");
                        return false;                        
                    }
                }   
                return true;
            }
                
        
            
        </script>
    </head>
    <body>

        <form name="form1" onsubmit="return validate();" action="dispatcher?operation=editviewerprofile" method="post">
            <table border="0">
                <tr>
                    <td>password:</td>
                    <td>            <input type="password" name="password"  size="20">
                    </td>
                </tr>
                <tr>
                    <td>nickname:</td>
                    <td>            <input type="text" name="nickname"  size="20">
                    </td>
                </tr>
                <tr>
                    <td>first name:</td>
                    <td>            <input type="text" name="firstname" size="20">
                    </td>
                </tr>
                <tr>
                    <td>last name:</td>
                    <td>            <input type="text" name="lastname" size="20">
                    </td>
                </tr>
                <tr>
                    <td>email:</td>
                    <td>            <input type="text" name="email" size="20"><br>
                    </td>
                </tr>
                <!--                <tr>
                                    <td>birthday:</td>
                                    <td>year:<input type="text" name="year" size="2">month:<input type="text" name="month" size="2">day:<input type="text" name="day" size="2"</td>
                                </tr>
                                <tr>-->
                <td>birthday:</td>
                <td><p><input type='text' size='12' id='calendarField' name='calendarField' /></p></td>
                </tr>
                <tr>
                    <td>favourite genres:</td>
                    <td><input type="checkbox" name="genres" value="1">Drama
                        <input type="checkbox" name="genres" value="2">Science Fiction
                        <input type="checkbox" name="genres" value="3">Horror
                        <input type="checkbox" name="genres" value="4">Action
                        <input type="checkbox" name="genres" value="5">Comedy
                        <input type="checkbox" name="genres" value="6">Cartoon</td>
                </tr>
                <tr>

                    <td>favourte actor/actress:</td>
                    <td>
                        <% List actorList = (List) request.getAttribute("actorList");
                            for (int i = 0; i < actorList.size(); i++) {%>
                              <%  Actor actor = (Actor) actorList.get(i) ;%>
                        <input type="checkbox" name="actors" value="<%=actor.getIdactor()%>"><%= actor.getFirstname()%>  <%= actor.getLastname()%>

                        <%}%>
                      
                </tr>
                <tr>
                    <td></td>
                    <td> <input type="submit" value="submit">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="button" value="cancel" onclick="javascript:location.href='myprofile.jsp'"></td>
                </tr>
            </table>




        </form>



    </body>
    <%@include file="footer.html"%>
</html>
